<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>


<script type="text/javascript" src="js/jquery.itextclear.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], textarea', '.form').iTextClear();
    });
</script>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="css/Tree.css"/>
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css"/>
<script type="text/javascript" src="lib/datatables/js/jquery.dataTables.js"></script>
<!-- DATATABLES CSS END -->

<h1 class="page-title">员工离职申请</h1>


<div class="container_12 clearfix leading">
    <section class="tabs grid_12 leading">
        <ul class="clearfix">
        </ul>
        <section>
            <section class="clearfix" style="display: block;">
                <header class="grid_12 alpha omega">

                </header>
                <div id="demo" class="clearfix">
                    <table class="display" id="example">
                        <thead>
                        <tr>
                            <th>选择</th>
                            <th>工号</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>部门</th>
                            <th>职务</th>
                            <th>职等职级</th>
                            <th>离职申请时间</th>
                            <th style=" width:80px">HR审核</th>
                            <th style=" width:80px">最终审核结果</th>
                        </tr>
                        </thead>
                        <tbody>
                        <s:if test="#request.applys == null or #request.applys.size() == 0">
                        <tr class="gradeX"><td colspan="10">暂无数据</td></tr>
                        </s:if>
                        <s:else>
                        <s:iterator value="#request.applys" var="ap" status="sta">
                        <tr class="grade${sta.even ? "A" : "C"}">
                            <td><input type="checkbox" id="form-updates" value="1"/></td>
                            <td>${ap.work.workNo}</td>
                            <td>${ap.work.baseId.name}</td>
                            <td>${ap.work.baseId.sex == '0' ? "男" : "女"}</td>
                            <td><span id="GridView1_ctl04_Label">${ap.work.organization.fullName}</span></td>
                            <td>${ap.work.duty.dutyName}</td>
                            <td>${ap.work.grade.gradeName}${ap.work.grade.gradeSort}</td>
                            <td><s:date name="#request.apply.create_date" format="yyyy-MM-dd"/> </td>
                            <td class="gradeX"><a class="button" href="javascript:void(0)">
                                <s:if test="#request.ap.hrStatus.toString() == 'wait_audit'">
                                    <span style="background:url(${ctx}/images/img/error.png)" class="icon">&nbsp;</span>待审核
                                </s:if>
                                <s:elseif test="#request.ap.hrStatus.toString() == 'reject_audit'">
                                    <span style="background:url(${ctx}/images/img/cancel.png)" class="icon">&nbsp;</span>未过核
                                </s:elseif>
                                <s:else>
                                    <span style="background:url(${ctx}/images/img/accept.png)" class="icon">&nbsp;</span>已过核
                                </s:else>
                            </a></td>
                            <td class="gradeX"><a class="button" href="javascript:void(0)">
                                <s:if test="#request.ap.status.toString() == 'wait_audit'">
                                    <span style="background:url(${ctx}/images/img/error.png)" class="icon">&nbsp;</span>待审核
                                </s:if>
                                <s:elseif  test="#request.ap.status.toString() == 'reject_audit'">
                                    <span style="background:url(${ctx}/images/img/cancel.png)" class="icon">&nbsp;</span>未过核
                                </s:elseif>
                                <s:else>
                                    <span style="background:url(${ctx}/images/img/accept.png)" class="icon">&nbsp;</span>已过核
                                </s:else>
                            </td>
                        </tr>
                        </s:iterator>
                        </s:else>
                        </tbody>
                    </table>
                </div>
            </section>
        </section>
    </section>


    <div class="tabs side grid_12 leading">
        <div class="clear"></div>
        <div class="grid_12">
            <div class="form-action clearfix">
                <p>
                    <%--<s:if test="#request.apply != null and #request.apply.hrStatus.toString() == 'wait_audit' and #request.apply.status.toString() == 'wait_audit'">
                    <a class="button" href="javascript:void(0)" onclick="doDelete()"><span style="background:url(${ctx}/images/img/delete.png)" class="icon">&nbsp;</span>删除</a>
                    <a class="button" href="javascript:void(0)" onclick="doEdit()"><span style="background:url(${ctx}/images/img/page_edit.png)" class="icon">&nbsp;</span>修改</a>
                    </s:if>--%>
                    <s:if test="#request.apply == null || #request.apply.hrStatus.toString() == 'reject_audit' || #request.apply.status.toString() == 'reject_audit'">
                    <a href="#public/leave-office-apply-input.xhtml" class="button"><span class="icon" style="background:url(${ctx}/images/img/add.png)">&nbsp;</span>申请</a>
                    </s:if>
                </p>
            </div>
        </div>
    </div>
</div>

<div class="clear"></div>

<script type="text/javascript" src="js/Tree.js"></script>
<script type="text/javascript">
    function doDelete(){
        if(confirm("确定要删除该离职申请吗？")){
            window.location.href = "#public/leave-office-apply-delete.xhtml?apply.id=${apply.id}&t="+(new Date().getTime());
        }
    }
    function doEdit(){
        window.location.href = "#public/leave-office-apply-input.xhtml?apply.id=${apply.id}&t="+(new Date().getTime());
    }
</script>